package datamining.code.processtable;

import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;

import datamining.code.connection.OracleConnection;

public class ProcessTransaction {
	static Connection connection = OracleConnection.getConnection();
	
	public static void retrieveSubject() {
		String sql = "select codpublicacao, titulo, count(CODPUBLICACAO) as vezes from emprestimo_2 where CODPUBLICACAO not in(select idpublicacao from dados) group by codpublicacao having count(CODPUBLICACAO) > 50 order by codpublicacao";
		PreparedStatement stmt;
//		String assunto="";
		try {
			stmt = connection.prepareStatement(sql);
			ResultSet rs = stmt.executeQuery();
			while (rs.next()) {
				System.out.println("Codigo: "+rs.getString("codpublicacao")+"\nTitulo: "+rs.getString("titulo")+"\n\n\n");
//				assunto= rs.getString("assunto");				:
			}
			stmt.close();
		} catch (SQLException e) {
			e.printStackTrace();
		}
//		return assunto;
	}
	
	public static void main(String[] args) {
		retrieveSubject();
	}

}


